os:    linux
dist:  trusty
group: edge
sudo:  false

language: python

python:
  - "2.7"

cache:
  pip: true
  apt: true
  directories:
    - "~/.platformio"

before_cache:
  - rm -f $HOME/.cache/pip/log/debug.log

before_install:
  - pip install -U platformio

addons:
  apt:
    packages:
      - cmake
      - build-essential

env:
  - PIO_BRD: "'-b uno'"         # arduino uno
#  - PIO_BRD: "'-b due'"         # arduino due  -> current tick-counting implentation not compatible
#  - PIO_BRD: "'-b zero'"        # arduino zero  -> current tick-counting implentation not compatible
  - PIO_BRD: "'-b teensy30 -b teensy31 -b teensy35 -b teensy36'" # teensy 3
#  - PIO_BRD: "'-b teensy20 -b teensy20pp'"                       # teensy 2  -> crc-lib has linker problem in platformIO but works in arduino-sw
  - PIO_BRD: "'-b esp01 -b nodemcuv2 -b espduino'"               # esp8266
  - PIO_BRD: "'-b espino32 -b esp32dev'"  # esp8266
#  - PIO_BRD: "'-b rfduino'"               # nrf51 -> will probably fail due to old gcc 4.8.3 with artificial limit to c++98
#  - PIO_BRD: "'-b lenny -b uno_pic32'"    # pic32mx -> error: pic32-g++ not found
#  - PIO_BRD: "'-b genuino101'"            # intel curie -> value_ipl is unknown for this hardware
#  - PIO_BRD: "'-b attiny88 -b attiny84'"  # attiny -> linker error for unknown virtual function
  - PIO_BRD: "'-b digispark-tiny'"        # attiny

before_script:
  - platformio init $PIO_BRD

script:
  - platformio ci --lib="." $PIO_BRD ./examples/BAE910_device/BAE910_device.ino
#  - platformio ci --lib="." $PIO_BRD ./examples/DS18B20_asInterface/DS18B20_asInterface.ino
  - platformio ci --lib="." $PIO_BRD ./examples/DS18B20_thermometer/DS18B20_thermometer.ino
  - platformio ci --lib="." $PIO_BRD ./examples/DS2401_serial/DS2401_serial.ino
  - platformio ci --lib="." $PIO_BRD ./examples/DS2405_switch/DS2405_switch.ino
  - platformio ci --lib="." $PIO_BRD ./examples/DS2408_switch/DS2408_switch.ino
  - platformio ci --lib="." $PIO_BRD ./examples/DS2413_switch/DS2413_switch.ino
  - platformio ci --lib="." $PIO_BRD ./examples/DS2423_RAM/DS2423_RAM.ino
  - platformio ci --lib="." $PIO_BRD ./examples/DS2431_EEPROM/DS2431_EEPROM.ino
  - platformio ci --lib="." $PIO_BRD ./examples/DS2433_EEPROM/DS2433_EEPROM.ino
  - platformio ci --lib="." $PIO_BRD ./examples/DS2438_battMon/DS2438_battMon.ino
  - platformio ci --lib="." $PIO_BRD ./examples/DS2450_ADC/DS2450_ADC.ino
  - platformio ci --lib="." $PIO_BRD ./examples/DS2502_DELLCHG/DS2502_DELLCHG.ino
  - platformio ci --lib="." $PIO_BRD ./examples/DS2502_EEPROM/DS2502_EEPROM.ino
  - platformio ci --lib="." $PIO_BRD ./examples/DS2506_EEPROM/DS2506_EEPROM.ino
  - platformio ci --lib="." $PIO_BRD ./examples/DS2890_poti/DS2890_poti.ino
  - platformio ci --lib="." $PIO_BRD ./examples/OneWireHubTest/OneWireHubTest.ino
  - mkdir build
  - cd ./build
  - cmake ..
  - make
  - ./OneWireHub
